001 package jgb.examples.eventhandlers; 002 003 import jgb.builder.WindowContext; 004 005 import javax.swing.*; 006 import java.util.EventObject; 007 008 public class SimpleEventWindowEventManager { 009 public void clearList(EventObject event, WindowContext context) { 010 DefaultListModel listModel = (DefaultListModel)context.getObject("listModel"); 011 listModel.clear(); 012 } 013 014 public void addEntry(EventObject event, WindowContext context) { 015 DefaultListModel listModel = (DefaultListModel)context.getObject("listModel"); 016 JTextField textValue = (JTextField)context.getObject("textValue"); 017 018 listModel.addElement(textValue.getText()); 019 textValue.setText(""); 020 textValue.requestFocus(); 021 } 022 023 public void quit(EventObject event, WindowContext context) { 024 System.exit(0); 025 } 026 }